package com.chen.spikemall.controller;

import com.chen.spikemall.bean.CommonGoods;
import com.chen.spikemall.bean.RespModel;
import com.chen.spikemall.service.GoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController("/goods")
public class GoodsController {

    @Autowired
    private GoodsService goodsService;

    @RequestMapping(method = RequestMethod.POST)
    public RespModel addGoods(@RequestBody CommonGoods goods) {
        goodsService.addGoods(goods, goods.getStoreValue());
        RespModel respModel = new RespModel();
        respModel.setCode("000000");
        respModel.setMsg("success");
        return respModel;
    }

}
